/* $RCSFile: LangChooserDesigner.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/ADNCRM.Core/UI/Design/LangChooserDesigner.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:29  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Diagnostics;
using System.IO;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Globalization;

using AddonNice.Diagnostics;
using AddonNice.UI.WebControls;

namespace AddonNice.UI.Design
{
	/// <summary>
	/// Designer support for LangChooser
	/// </summary>
	public class LangChooserDesigner : System.Web.UI.Design.ControlDesigner 
	{
		/// <summary>
		/// Component is the instance of the component or control that
		/// this designer object is associated with. This property is 
		/// inherited from System.ComponentModel.ComponentDesigner.
		/// </summary>
		/// <returns></returns>
		public override string GetDesignTimeHtml()
		{
			try
			{
				LangChooser langSwitcher = (LangChooser) Component;

				StringWriter sw = new StringWriter(System.Globalization.CultureInfo.CurrentUICulture); //IFormatProvider should be passed
				HtmlTextWriter tw = new HtmlTextWriter(sw);

				langSwitcher.RenderControl(tw);

				return sw.ToString();
			}
			catch(Exception ex)
			{
                if ( GlobalTraceSwitch.Sw.TraceError )
                    Trace.WriteLine( string.Format(CultureInfo.InvariantCulture,"LangChooserDesigner GetDesignTimeHtml ex : {0}", ex),GlobalTraceSwitch.Sw.Info);
                throw;
			}
		}
	}
}
